package operators;

class A {}

public class B extends A {
	public static void main(String[] args) {
		A myA = new B();
		//if(myA instanceof A) System.out.println("instance of A");
		//if(myA instanceof B) System.out.println("instance of B");
		//B myB = (B)myA;
		m2(myA);
	}
	
	public static void m2(A a) {
		if (a instanceof B) 
			((B)a).doStuff();
	}
	
	public static void doStuff() {
		System.out.println("'a' refers to a B");
	}
}
